package com.innovation.chengzhangriji.ui.widget;

import android.content.Context;
import android.view.View;

public class TimelinePhotoViewHolder extends TimelineViewHolder implements ImageGroup.OnClickImageListener {

    public interface OnClickImageListener {

        void onClickImage(TimelinePhotoViewHolder holder,int index);

        void onLongClickImage(TimelinePhotoViewHolder holder,int index);
    }

    private TimelinePhotoView mPhoto;

    private OnClickImageListener mOnClickImageListener;

    public TimelinePhotoViewHolder(Context context, View itemView) {
        super(context, itemView);
        mPhoto = new TimelinePhotoView(context);
        mPhoto.setOnClickImageListener(this);
        getContent().addView(mPhoto);
    }

    public void setPhotoGroup(String... urls) {
        mPhoto.setImageGroup(urls);
    }

    public void setThemeAndText(String theme, String text) {
        mPhoto.setThemeAndText(theme, text);
    }

    public void setOnClickImageListener(OnClickImageListener listener) {
        mOnClickImageListener = listener;
    }

    @Override
    public void onClickImage(int index) {
        mOnClickImageListener.onClickImage(this,index);
    }

    @Override
    public void onLongClickImage(int index) {
        mOnClickImageListener.onLongClickImage(this,index);
    }

}
